package org.dbrd.preprocessor.filters;

public class HTMLTagFilter extends AbstractWordFilter {

	@Override
	protected String[] filter(String word) {
		word = word.replaceAll("\\<\\s*a.*?\\>.*?\\<\\s*/\\s*a\\s*\\>", " ");
		word = word.replaceAll("(\\<\\s*pre\\s*\\>)", " ");
		word = word.replaceAll("(\\<\\s*/\\s*pre\\s*\\>)", " ");
		return new String[] {word};
	}

	public static void main(String[] args) {
		String s = ":<a href=\"http://www.openoffice.org/servlets/ReadMsg?list=dev&msgNo=21247\">" +
				"http://www.openoffice.org/servlets/ReadMsg?list=dev&amp;msgNo=21247" +
				"</a>" +
				"User Forum Message Refers:" +
				"<a href=\"http://user.services.openoffice.org/en/forum/viewtopic.php?f=5&t=1289\">" +
				"http://user.services.openoffice.org/en/forum/viewtopic.php?f=5&amp;t=1289" +
				"</a>" +
				"In your dialogue you mentions that Excel has a bug in its implementation of30U/360, " +
				"and states that Calc MUST be compatible with Excel.  Yes Excel has abug, and NO CALC " +
				"is NOT compatible with Excel.  I have attached a spreadsheet* which compares " +
				"Excel and Calc against 3OU/360 against a reasonable test cover  showing how Excel " +
				"deviates from 3OU/360 and Calc from Excel* Provides Basic functions which " +
				"implements  * The 3OU/360 Algo  * The Excel Algo showing the bug and why it gets " +
				"the wrong answer  * The Calc Algo showing its bug and why it disagrees with Excel.The " +
				"code in sc/source/core/tool/interpr2.cxx would be trivial to make compatiblewith Excel, " +
				"so it seems a shame for this incompatibility to remain.  " +
				"Do you wantme to propose a patch?</pre>me to propose a patch?";
		System.out.println(new HTMLTagFilter().filter(s)[0]);
	}
}
